﻿<%@ page import="java.util.*" %>
<%@ page import="com.hotel.BL.RoomLogic" %>
<%@ page import="com.google.appengine.labs.repackaged.org.json.JSONObject" %>
<%@ page import ="java.util.ArrayList"%>
<%@ page import ="java.util.List"%>
<%@ page import ="data.Room"%>
<%@ page import ="data.CleaningStatus"%>
<%@ page import ="data.RoomType"%>
<%@ page import ="java.text.DateFormat"%>

<%

	String Code = (String)session.getAttribute("LanguageCode");
	String SubCode = (String)session.getAttribute("LanguageSubcode");
	long hotelId = (Long)session.getAttribute("hotelId");
    Locale locale = new Locale(Code, SubCode);
	ResourceBundle resource = ResourceBundle.getBundle("resource", locale);
	
	DateFormat shortDf = DateFormat.getDateInstance(DateFormat.SHORT);
	
	Calendar dateCal = Calendar.getInstance();
	dateCal.setTime(new Date());
	
	List<Date> date = new ArrayList<Date>();
	date.add(dateCal.getTime());
	
	for(int i=1;i<3;i++)
	{
		dateCal.add(Calendar.DATE, 1);
		date.add(dateCal.getTime());
	}
%>
<link href="css/components/blocked/blocked.css" rel="stylesheet" />

<link href="css/components/rightclickmenu/jquery.contextmenu.css" rel="stylesheet" />
<script src="js/components/rightclickmenu/jquery.contextmenu.js"></script>

<script src="/js/components/blocked/popup/popup.js"></script>
<script src="/js/components/blocked/blocked.js"></script>
<link href="css/components/blocked/popup/popup.css" rel="stylesheet" />
<div id="timespanFail"></div>
<div class="setright">
<table width="100%" cellspacing="0" style="margin-bottom: 2px; margin-top: 2px;"  class="nowrap" >

<tr id="date" style="height:21px; text-align:center;">
<td style="background-color:#fff; border:1px ridge #fff;width:16%">&nbsp</td>
<td style="background-color:#4ab6ff; border:1px ridge #fff;width:28%" date="<%=shortDf.format(date.get(0)) %>" ><%=date.get(0).getDate() %></td>
<td style="background-color:#a5ddf6; border:1px ridge #fff;width:28%" date="<%=shortDf.format(date.get(1)) %>"><%=date.get(1).getDate() %></td>
<td style="background-color:#a5ddf6;border:1px ridge #fff;width:28%" date="<%=shortDf.format(date.get(2)) %>"><%=date.get(2).getDate() %></td>
</tr>

<%
	RoomLogic r = new RoomLogic(request);
	List<Room> list = r.GetAllRoom(hotelId);
	List<List<List<Room>>> group = r.GetRoomGroupByRoomType(list);
	for(List<List<Room>> block : group)
	{
%>
<tr block="<%out.print(block.get(0).get(0).getBlock().getId());%>" onclick="displayCountBlock(this)">
<td style="height:17px;background-color:#666767; cursor: pointer;" colspan="4" class="head" >
&nbsp;<img src="images/components/blocked/link.png" width="13px" height="13px" style="float:left; margin-left:2px;" /> &nbsp;<span class="headtext"><%=block.get(0).get(0).getBlock().getTitle()%></span>
</td>
</tr>
<%
	for(List<Room> item : block)
	{
		String shortName = item.get(0).getRoomtype().getShortName();
		long roomtype = item.get(0).getRoomtype().getId();
		String id = String.valueOf(item.get(0).getRoomtype().getId());
%>
<tr block="<%=item.get(0).getBlock().getId()%>" roomtype="<%=item.get(0).getRoomtype().getId()%>" style=" cursor: pointer;" onclick="displayCountRoomType(this)">
<td class="head" colspan="4">

&nbsp;<img src="images/components/blocked/link.png" width="13px" height="13px" />&nbsp;<span class="text"><%out.print(item.get(0).getRoomtype().getShortName());%></span>
</tr>

<% for(Room rm : item){ %>
	<tr block="<%out.print(rm.getBlock().getId());%>" roomType="<%out.print(rm.getRoomtype().getId());%>" roomName="<%out.print(rm.getId());%>">
		<td class="cell" cleaningStatus="<%=rm.getCleaningStatus().getTitle()%>">
			<%out.print(rm.getRoomName());%></td>
		<td class="cell" date="<%=shortDf.format(date.get(0)) %>"></td>
		<td class="cell" date="<%=shortDf.format(date.get(1)) %>"></td>
		<td class="cell" date="<%=shortDf.format(date.get(2)) %>"></td>
	</tr>
<% } %>
 
 <% }
 }
 %>


<tr>
<td class="head" style="background-color:#3b69b3;  !Important" colspan="4">
&nbsp;<span class="headtext"><%out.print(resource.getString("blocked.totalcheckinroom"));%></span>
</td>
</tr>
<tr style="background-color:#c5d2e5;" class="totalcheckinroom" name="checkIn">
<td class="cell1">
&nbsp;<span class="text" ><%out.print(resource.getString("blocked.checkIn"));%></span>

</td>

<td class="cell"></td>
<td class="cell"></td>
<td class="cell"></td>
</tr>
<tr class="totalcheckinroom" name="book">
<td class="cell1">
&nbsp;<span class="text"><%out.print(resource.getString("blocked.book"));%></span>

</td>
<td class="cell"></td>
<td class="cell"></td>
<td class="cell"></td>
</tr>
<tr style="background-color:#c5d2e5;" class="totalcheckinroom" name="totalSell">
<td class="cell1">
&nbsp;<span class="text"><%out.print(resource.getString("blocked.totalSell"));%></span>
</td>
<td class="cell"></td>
<td class="cell"></td>
<td class="cell"></td>
</tr>
<tr class="totalcheckinroom" name="unoccupied">
<td class="cell1">
&nbsp;<span class="text"><%out.print(resource.getString("blocked.unoccupied"));%></span>

</td>
<td class="cell"></td>
<td class="cell"></td>
<td class="cell"></td>
</tr>
<tr style="background-color:#c5d2e5;" class="totalcheckinroom" name="roomAmount">
<td class="cell1">
&nbsp;<span class="text"><%out.print(resource.getString("blocked.roomAmount"));%></span>

</td>
<td class="cell"></td>
<td class="cell"></td>
<td class="cell"></td>
</tr>

</table>

</div>
<div id="dialog-confirm-delete-reserved" title="Remove reserved room."style="display:none;"> Do you want to remove this reserved ? </div>
<div id="dialog-confirm-delete-reserved-success" style="display:none;">  remove the reserved successful. </div>
<div id="dialog-confirm-delete-reserved-nosuccess" style="display:none;">  remove the reserved no success please check your data again.</div>
<jsp:include page="/components/blocked/popup/popup.jsp" flush="true"/>